class Solution {
    List<List<Integer>> lists = new ArrayList<List<Integer>>();
    List<Integer> list = new ArrayList<>();

    public List<List<Integer>> subsets(int[] nums) {
        dfc(0,nums);
        return lists;
    }

    public void dfc(int length,int[] nums) {
        if(length == nums.length) {
            lists.add(new ArrayList<Integer>(list));
            return;
        }
        list.add(nums[length]);
        dfc(length+1,nums);
        list.remove(list.size()-1);
        dfc(length+1,nums);
    }
}